<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#one{width:200px;height:200px;background:red;}
</style>
<script>
window.onload=function(){
	var oBtn=document.getElementsByTagName("input")[0];
	var oDiv=document.getElementById("one");
	oBtn.onclick=function(){
		//alert(css(oDiv,'width'))	
		css(oDiv,'background','green')
	};	
	
};
function css(obj,attr,value){
	if(arguments.length==2){
		return getStyle(obj,attr)
	}else if(arguments.length==3){
		obj.style[attr]=value;	
	}	
};
function getStyle(obj,attr){
	if(document.all){
		return obj.currentStyle[attr];	
	}else{
		return getComputedStyle(obj,null)[attr];	
	}	
};

</script>
</head>

<body>
<input type="button" value="样式" />
<div id="one"></div>
</body>
</html>
